E-commerce Supply Chain Analysis¶

To analyze a company's supply chain,we need data on the different stages of the supply chain like data about sourcing, manufacturing, transportation,inventory management,sales and customer demographic.

In [1]:
# import python libraries
%pip install plotly
import pandas as pd 
import plotly.express as px
import plotly.io as pio
import plotly.graph_objects as go
pio.templates.default="plotly_white"
Requirement already satisfied: plotly in c:\users\amrendra mishra\anaconda3\lib\site-packages (5.9.0)
Requirement already satisfied: tenacity>=6.2.0 in c:\users\amrendra mishra\anaconda3\lib\site-packages (from plotly) (8.2.2)
Note: you may need to restart the kernel to use updated packages.
In [2]:
data =pd.read_csv("supply_chain_data.csv")
data.head()
Out[2]:
Product type SKU Price Availability Number of products sold Revenue generated Customer demographics Stock levels Lead times Order quantities ... Location Lead time Production volumes Manufacturing lead time Manufacturing costs Inspection results Defect rates Transportation modes Routes Costs
0 haircare SKU0 69.808006 55 802 8661.996792 Non-binary 58 7 96 ... Mumbai 29 215 29 46.279879 Pending 0.226410 Road Route B 187.752075
1 skincare SKU1 14.843523 95 736 7460.900065 Female 53 30 37 ... Mumbai 23 517 30 33.616769 Pending 4.854068 Road Route B 503.065579
2 haircare SKU2 11.319683 34 8 9577.749626 Unknown 1 10 88 ... Mumbai 12 971 27 30.688019 Pending 4.580593 Air Route C 141.920282
3 skincare SKU3 61.163343 68 83 7766.836426 Non-binary 23 13 59 ... Kolkata 24 937 18 35.624741 Fail 4.746649 Rail Route A 254.776159
4 skincare SKU4 4.805496 26 871 2686.505152 Non-binary 5 3 56 ... Delhi 5 414 3 92.065161 Fail 3.145580 Air Route A 923.440632

5 rows × 24 columns

In [3]:
data.describe()
Out[3]:
Price Availability Number of products sold Revenue generated Stock levels Lead times Order quantities Shipping times Shipping costs Lead time Production volumes Manufacturing lead time Manufacturing costs Defect rates Costs
count 100.000000 100.000000 100.000000 100.000000 100.000000 100.000000 100.000000 100.000000 100.000000 100.000000 100.000000 100.00000 100.000000 100.000000 100.000000
mean 49.462461 48.400000 460.990000 5776.048187 47.770000 15.960000 49.220000 5.750000 5.548149 17.080000 567.840000 14.77000 47.266693 2.277158 529.245782
std 31.168193 30.743317 303.780074 2732.841744 31.369372 8.785801 26.784429 2.724283 2.651376 8.846251 263.046861 8.91243 28.982841 1.461366 258.301696
min 1.699976 1.000000 8.000000 1061.618523 0.000000 1.000000 1.000000 1.000000 1.013487 1.000000 104.000000 1.00000 1.085069 0.018608 103.916248
25% 19.597823 22.750000 184.250000 2812.847151 16.750000 8.000000 26.000000 3.750000 3.540248 10.000000 352.000000 7.00000 22.983299 1.009650 318.778455
50% 51.239831 43.500000 392.500000 6006.352023 47.500000 17.000000 52.000000 6.000000 5.320534 18.000000 568.500000 14.00000 45.905622 2.141863 520.430444
75% 77.198228 75.000000 704.250000 8253.976921 73.000000 24.000000 71.250000 8.000000 7.601695 25.000000 797.000000 23.00000 68.621026 3.563995 763.078231
max 99.171329 100.000000 996.000000 9866.465458 100.000000 30.000000 96.000000 10.000000 9.929816 30.000000 985.000000 30.00000 99.466109 4.939255 997.413450

Revenue Generated by the price of the product¶

In [4]:
fig=px.scatter(data,x='Price',y='Revenue generated',color='Product type',hover_data=['Number of products sold'],trendline="ols")
fig.show()

The heighest revenue resource of this company is cosmetic product¶

Hence,Cosmetic product revenue generated the most

Analyze the Sales by Product Type¶

In [5]:
sales_data=data.groupby('Product type')['Number of products sold'].sum().reset_index()
sales_data
Out[5]:
Product type Number of products sold
0 cosmetics 11757
1 haircare 13611
2 skincare 20731
In [6]:
pie_chart=px.pie(sales_data,values='Number of products sold',names='Product type',title='Sales by Product type',hover_data=['Number of products sold'],hole=0.5,color_discrete_sequence=px.colors.qualitative.Pastel)
In [7]:
pie_chart.update_traces(textposition='inside',textinfo='percent+label')
pie_chart.show()

So,45%of the business comes from Skincare products,29.5% from Haircare,25.5% from cosmetics.

Total Revenue Generated from the Shipping Carriers¶

In [8]:
total_revenue=data.groupby('Shipping carriers')['Revenue generated'].sum().reset_index()
total_revenue
Out[8]:
Shipping carriers Revenue generated
0 Carrier A 142629.994607
1 Carrier B 250094.646988
2 Carrier C 184880.177143
In [9]:
fig=go.Figure()
fig.add_trace(go.Bar(x=total_revenue['Shipping carriers'],y=total_revenue['Revenue generated']))
fig.update_layout(title='Total Revenue by shipping carriers',xaxis_title='Shipping carriers',yaxis_title='Revenue generated')
fig.show()

Analyze the Revenue Generated by each SKU¶

define SKU:¶

"SKU stands for “stock keeping unit” and — as the name suggests — it is a number (usually eight alphanumeric digits) that retailers assign to products to keep track of stock levels internally".

In [10]:
revenue_chart=px.line(data,x='SKU',y='Revenue generated',title='Revenue Generated by SKU')
revenue_chart.show()

Analyze the order Quantity of each SKU¶

In [11]:
order_quantity_chart=px.bar(data,x='SKU',y='Order quantities',title='Order Quantity by SKU')
order_quantity_chart.show()

Analyze the Shipping cost of Carriers¶

In [12]:
Shipping_costs_chart=px.bar(data,x='Shipping carriers',y='Shipping costs',title='Shipping Costs by Carrier')
Shipping_costs_chart.show()

To Find the Cost Distribution by Transportation mode¶

In [13]:
data.head()
Out[13]:
Product type SKU Price Availability Number of products sold Revenue generated Customer demographics Stock levels Lead times Order quantities ... Location Lead time Production volumes Manufacturing lead time Manufacturing costs Inspection results Defect rates Transportation modes Routes Costs
0 haircare SKU0 69.808006 55 802 8661.996792 Non-binary 58 7 96 ... Mumbai 29 215 29 46.279879 Pending 0.226410 Road Route B 187.752075
1 skincare SKU1 14.843523 95 736 7460.900065 Female 53 30 37 ... Mumbai 23 517 30 33.616769 Pending 4.854068 Road Route B 503.065579
2 haircare SKU2 11.319683 34 8 9577.749626 Unknown 1 10 88 ... Mumbai 12 971 27 30.688019 Pending 4.580593 Air Route C 141.920282
3 skincare SKU3 61.163343 68 83 7766.836426 Non-binary 23 13 59 ... Kolkata 24 937 18 35.624741 Fail 4.746649 Rail Route A 254.776159
4 skincare SKU4 4.805496 26 871 2686.505152 Non-binary 5 3 56 ... Delhi 5 414 3 92.065161 Fail 3.145580 Air Route A 923.440632

5 rows × 24 columns

In [14]:
transportation_chart=px.pie(data,values='Costs',names='Transportation modes',title='Cost Distribution by Transportation mode',hole=0.5,color_discrete_sequence=px.colors.qualitative.Pastel)
transportation_chart.show()

Analyze Defect Rate of the product¶

In [15]:
defect_rates_by_product=data.groupby('Product type')['Defect rates'].mean().reset_index()
defect_rates_by_product
fig=px.bar(defect_rates_by_product,x='Product type',y='Defect rates',title='Average Defect Rates by Product Types')
fig.show()
In [ ]:
 
In [ ]:
 
In [ ]: